package com.glueball.crm.module.client.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "client")
@Document(collection="clients")
public class Client implements Serializable {
    
    private static final long serialVersionUID = 1L;

    @XmlAttribute
    @Id
    private String id;
    private String clientNumber = "";
    private String type;
    private ClientData data;

    @DBRef
    private Address    address;

    @DBRef
    private List<Address> postAddress;

    @DBRef
    private List<Contact> contacts = new ArrayList<Contact>();

    @DBRef
    private List<BankAccount> bankAccounts = new ArrayList<BankAccount>();

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getClientNumber() {
        return this.clientNumber==null?"":this.clientNumber;
    }

    public void setClientNumber(String clientNumber) {
        this.clientNumber = clientNumber;
    }

    public List<Contact> getContacts() {
        return this.contacts == null?new ArrayList<Contact>():this.contacts;
    }

    public void setContacts(List<Contact> contacts) {
        this.contacts = contacts;
    }

    public List<BankAccount> getBankAccounts() {
        return this.bankAccounts==null?new ArrayList<BankAccount>():this.bankAccounts;
    }

    public void setBankAccounts(List<BankAccount> bankAccounts) {
        this.bankAccounts = bankAccounts;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public ClientData getData() {
        return data;
    }

    public void setData(ClientData data) {
        this.data = data;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public List<Address> getPostAddress() {
        return postAddress;
    }

    public void setPostAddress(List<Address> postAddress) {
        this.postAddress = postAddress;
    }
}
